package com.hello.system.service.impl;

import java.util.List;
import com.hello.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hello.system.mapper.UserPasswordsMapper;
import com.hello.system.domain.UserPasswords;
import com.hello.system.service.IUserPasswordsService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
 * 用户密码安全存储Service业务层处理
 * 
 * @author hello
 * @date 2025-10-29
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class UserPasswordsServiceImpl extends ServiceImpl<UserPasswordsMapper, UserPasswords> implements IUserPasswordsService 
{
    private final UserPasswordsMapper userPasswordsMapper;

    /**
     * 查询用户密码安全存储
     * 
     * @param id 用户密码安全存储主键
     * @return 用户密码安全存储
     */
    @Override
    public UserPasswords selectUserPasswordsById(Long id)
    {
        return userPasswordsMapper.selectUserPasswordsById(id);
    }

    /**
     * 查询用户密码安全存储列表
     * 
     * @param userPasswords 用户密码安全存储
     * @return 用户密码安全存储
     */
    @Override
    public List<UserPasswords> selectUserPasswordsList(UserPasswords userPasswords)
    {
        return userPasswordsMapper.selectUserPasswordsList(userPasswords);
    }

    /**
     * 新增用户密码安全存储
     * 
     * @param userPasswords 用户密码安全存储
     * @return 结果
     */
    @Override
    public int insertUserPasswords(UserPasswords userPasswords)
    {
        userPasswords.setCreateTime(DateUtils.getNowDate());
        return userPasswordsMapper.insertUserPasswords(userPasswords);
    }

    /**
     * 修改用户密码安全存储
     * 
     * @param userPasswords 用户密码安全存储
     * @return 结果
     */
    @Override
    public int updateUserPasswords(UserPasswords userPasswords)
    {
        userPasswords.setUpdateTime(DateUtils.getNowDate());
        return userPasswordsMapper.updateUserPasswords(userPasswords);
    }


    /**
     * 批量删除用户密码安全存储
     * 
     * @param ids 需要删除的用户密码安全存储主键
     * @return 结果
     */
    @Override
    public int deleteUserPasswordsByIds(Long[] ids)
    {
        return userPasswordsMapper.deleteUserPasswordsByIds(ids);
    }

    /**
     * 删除用户密码安全存储信息
     * 
     * @param id 用户密码安全存储主键
     * @return 结果
     */
    @Override
    public int deleteUserPasswordsById(Long id)
    {
        return userPasswordsMapper.deleteUserPasswordsById(id);
    }
}
